import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const state = {
  userId:sessionStorage.getItem("userIds") || '', // 用户
  agentId: '', // 坐席工号
  agentName: '', // 坐席姓名
  // themeColor: '', // 主题颜色
  orderDetailsId: '', // 工单编号id
  typeData: 1, // 交互处:1:工单历史 2:查看工单
  orderTypeId: 1, // 工单流程过滤id
  workOrderTypeId: 0, // 工单流程id
  orderTitle: '', // 工单标题
  workStatusId: '', // 状态
  customFieldId: '', // 自定义字段id
  formWorkId: '', // 工单模板id
  workTypeId: '', // 类型id
  typeMenuId: '', // 类型菜单id
  filterMenuId: '', // 过滤器菜单
  orderTypeName: '所有工单列表', // 工单列表名字
  systemTypeName: '自定义字段', // 系统配置
  optionType: '1', // 过滤器菜单
  triggerId: '1', // 触发器工单id
  triggerTypeId: '', // 触发器流程id
  historyId: 1, // 历史工单id
  isSystemField: false, // 是否是系统字段
  dataShowTypeTitleId: 1, // 数据分析
  setNoticeType: '1', // 通知设置
  setNoticeId:""
}
const getters = {
  timeStampStore(state) {
    return state.times
  },
  userId: state => {
    return state.userId
  },
  agentId: state => {
    return state.agentId
  },
  agentName: state => {
    return state.agentName
  },

}
const mutations = {

  userIdFun(state, val) {
    state.userId = val
  },
  agentIdFun(state, val) {
    state.agentId = val
  },
  agentNameFun(state, val) {
    state.agentName = val
  },
  orderDetailsIdFun(state, val) {
    state.orderDetailsId = val
  },
  typeDataFun(state, val) {
    state.typeData = val
  },
  orderTypeIdFun(state, val) {
    state.orderTypeId = val
  },
  workOrderTypeIdFun(state, val) {
    state.workOrderTypeId = val
  },
  orderTitleFun(state, val) {
    state.orderTitle = val
  },

  optionTypeFun(state, val) {
    state.optionType = val
  },
  // 通知设置
  setNoticeIdFun(state, val) {
  state.setNoticeType = val
  },
  // 编辑模板id
  newNoticeIdFun(state, val) {
  state.newNoticeId = val
  },
  // 新建模板name
  newWorkIdFun(state, val) {
    state.newWorkName = val
  },
  orderTypeNameFun(state, val) {
    state.orderTypeName = val
  },
  // 工单状态id
  workStatusIdFun(state, val) {
    state.workStatusId = val
  },
  // 自定义字段Id
  customFieldIdFun(state, val) {
    state.customFieldId = val
  },
  // 模板id
  formWorkFun(state, val) {
    state.formWorkId = val
  },
  // 工单流程id
  changeWorkTypeId(state, val) {
    state.workTypeId = val
  },
  // 类型菜单Id
  typeMenuIdFun(state, val) {
    state.typeMenuId = val
  },
  // 自定义菜单Id
  filterMenuIdFun(state, val) {
    state.filterMenuId = val
  },
  // 系统配置名
  systemConfigTitFun(state, params) {
    state.systemTypeName = params.name
  },

  // 历史工单数据
  orderHistoryDetailsIdFun(state, val) {
    state.historyId = val
  },
  dataShowTypeTitleIdFun(state, val) {
    state.dataShowTypeTitleId = val
  },
  // 更改触发器的id
  tiggerIdFun(state, val) {
    state.triggerId = val
  },
  // 触发器流程id
  triggerTypeIdFun(state, val) {
    state.triggerTypeId = val
  },
  isSystemFieldFun(state, val) {
    state.isSystemField = val
  },
  // 通知设置id
  setNoticeFun(state, val) {
    state.setNoticeId = val
    console.log(val,"****************")
  },

}
const store = new Vuex.Store({
  state,
  getters,
  mutations
})
export default store
